package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.admin.query.HeaderFieldsQuery;
import org.jsola.admin.vo.HeaderFieldsVO;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.dto.TreatmentDisposeEventAddDTO;
import org.jsola.hr.dto.TreatmentDisposeEventUpdateDTO;
import org.jsola.hr.query.TreatmentDisposeEventExportQuery;
import org.jsola.hr.query.TreatmentDisposeEventQuery;
import org.jsola.hr.vo.ImportExcelResultListVO;
import org.jsola.hr.vo.TreatmentDisposeEventListVO;
import org.jsola.hr.vo.TreatmentDisposeEventVO;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * 待遇处理事件
 *
 * @author zhr
 */
@Api(tags = "hr-待遇处理事件")
public interface ITreatmentDisposeEventControllerAPI {

    /**
     * 新增待遇处理事件
     *
     * @param treatmentDisposeEventAddDTO 待遇处理事件新增实体
     * @return 待遇处理事件展示对象
     */
    @ApiOperation(value = "新增待遇处理事件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "treatmentDisposeEventAddDTO", dataType = "TreatmentDisposeEventAddDTO", value = "新增待遇处理事件", paramType = "body")
    })
    Result<TreatmentDisposeEventVO> save(TreatmentDisposeEventAddDTO treatmentDisposeEventAddDTO);


    /**
     * 修改待遇处理事件
     *
     * @param treatmentDisposeEventUpdateDTO 待遇处理事件
     * @return 更新数量
     */
    @ApiOperation(value = "修改待遇处理事件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "treatmentDisposeEventUpdateDTO", dataType = "TreatmentDisposeEventUpdateDTO", value = "修改待遇处理事件", paramType = "body")
    })
    Result<Integer> update(TreatmentDisposeEventUpdateDTO treatmentDisposeEventUpdateDTO);


    /**
     * 删除单个待遇处理事件，彻底删除
     *
     * @param treatmentDisposeEventId 待遇处理事件id
     * @return 删除数量
     */
    @ApiOperation(value = "删除单个待遇处理事件，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "treatmentDisposeEventId", dataType = "String", value = "待遇处理事件id", paramType = "path")
    })
    Result<Integer> delete(String treatmentDisposeEventId);


    /**
     * 批量删除待遇处理事件，彻底删除
     *
     * @param treatmentDisposeEventIds 待遇处理事件id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除待遇处理事件，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "treatmentDisposeEventIds", dataType = "String[]", value = "待遇处理事件id数组", paramType = "body", allowMultiple = true)
    })
    Result<Integer> deleteBatch(String[] treatmentDisposeEventIds);


    /**
     * 根据待遇处理事件id查询待遇处理事件详情
     *
     * @param treatmentDisposeEventId 待遇处理事件id
     * @return 待遇处理事件详情
     */
    @ApiOperation(value = "根据待遇处理事件id查询待遇处理事件详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "treatmentDisposeEventId", dataType = "String", value = "待遇处理事件id", paramType = "path")
    })
    Result<TreatmentDisposeEventVO> findById(String treatmentDisposeEventId);


    /**
     * 查询待遇处理事件
     *
     * @param treatmentDisposeEventQuery 待遇处理事件查询参数
     * @return page
     */
    @ApiOperation(value = "查询待遇处理事件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "treatmentDisposeEventQuery", dataType = "TreatmentDisposeEventQuery", value = "待遇处理事件查询参数", paramType = "query")
    })
    Result<List<TreatmentDisposeEventListVO>> listAll(TreatmentDisposeEventQuery treatmentDisposeEventQuery);


    /**
     * 分页查询待遇处理事件
     *
     * @param treatmentDisposeEventQuery 待遇处理事件查询参数
     * @return page
     */
    @ApiOperation(value = "分页查询待遇处理事件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "treatmentDisposeEventQuery", dataType = "TreatmentDisposeEventQuery", value = "待遇处理事件查询参数", paramType = "query")
    })
    Result<Page<TreatmentDisposeEventListVO>> page(TreatmentDisposeEventQuery treatmentDisposeEventQuery);

    /**
     * 完结事件或恢复未完结
     *
     * @param eventId 事件Id
     * @param status  完结状态
     * @return 执行结果
     */
    @ApiOperation(value = "完结事件或恢复未完结")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "eventId", dataType = "String", value = "事件Id", paramType = "query"),
            @ApiImplicitParam(name = "status", dataType = "Boolean", value = "完结状态", paramType = "query")
    })
    Result<String> finishOrUnfinishedEvent(String eventId, Boolean status);

    /**
     * 查询事件详情
     *
     * @param eventId 事件Id
     * @return 事件详情
     */
    @ApiOperation(value = "查询事件详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "eventId", dataType = "String", value = "事件Id", paramType = "path"),
    })
    Result<TreatmentDisposeEventVO> selectEventInfoById(@PathVariable() String eventId);

    /**
     * 导入事件
     *
     * @param templateId 模板Id
     * @param file       文件
     * @return 导入结果
     */
    @ApiOperation(value = "导入事件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file",
                    value = "文件，Content-Type需要设置为multipart/form-data",
                    paramType = "form"),
            @ApiImplicitParam(name = "templateId", dataType = "String", value = "模板Id", paramType = "path")
    })
    Result<ImportExcelResultListVO<Map<String, String>>> importEvent(String templateId, MultipartFile file);

    /**
     * 导入事件,错误数据导出
     *
     * @param errorInfo 导出参数
     * @return Excel
     */
    @ApiOperation(value = "导入事件,错误数据导出")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "errorInfo", dataType = "ImportExcelResultListVO", value = "导出参数", paramType = "body"),
    })
    ResponseEntity<Resource> exportErrorList(ImportExcelResultListVO<Map<String, String>> errorInfo);

    /**
     * 查询相关员工的待遇处理事件
     *
     * @param empId 员工Id
     * @return 相关员工的待遇处理事件
     */
    @ApiOperation(value = "查询相关员工的待遇处理事件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empId", dataType = "String", value = "员工Id", paramType = "path"),
    })
    Result<List<TreatmentDisposeEventVO>> selectEventByEmpId(String empId);

    /**
     * 导出事件
     *
     * @param query 导出参数
     * @return Excel
     */
    @ApiOperation(value = "导出事件")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "query", dataType = "TreatmentDisposeEventExportQuery", value = "导出参数", paramType = "body"),
    })
    ResponseEntity<Resource> export(TreatmentDisposeEventExportQuery query);

    /**
     * 获取导出表头
     *
     * @param headerQuery 导出参数
     * @return 表头
     */
    @ApiOperation(value = "获取导出表头")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "headerQuery", dataType = "HeaderFieldsQuery", value = "查询参数", paramType = "query"),
    })
    Result<HeaderFieldsVO> getEventExportHead(HeaderFieldsQuery headerQuery);

    /**
     * 查询对应模板下是否存在未完结事件
     *
     * @param templateId 模板id
     * @return 是否存在未完结事件
     */
    @ApiImplicitParams({
            @ApiImplicitParam(name = "templateId", dataType = "String", value = "模板Id", paramType = "path"),
    })
    Result<Boolean> existsNotFinish(String templateId);

}

